{extend name="panel/layout" /}
{block name="main"}
<div id="main-container">
    <div id="breadcrumb">
        <ul class="breadcrumb">
            <li><i class="fa fa-home"></i><a href="/"> 首页</a></li>
            <li><i class="fa fa-desktop"></i><a href="{:url('index')}"> 控制面板</a></li>
            <li class="active">我的QQ列表</li>
        </ul>
    </div><!-- /breadcrumb-->
    <div class="main-header clearfix">
        <div class="page-title">
            <h3 class="no-margin">自助下单</h3>
        </div><!-- /page-title -->
    </div>
    <div class="padding-md">
        <div class="row">
            <div class="col-xs-12">
                <div class="panel panel-danger">
                    <div class="panel-heading">
                        <h3 class="panel-title" align="center">下单说明！</h3>
                    </div>
                    {:getHtmlCode(config('web_gg_dgadd'))}
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-warning">
                    <div class="panel-heading">
                        自助下单
						<span class="pull-right">
							<label class="label-checkbox inline">
                                剩余金币：{$userInfo.point}
                            </label>
						</span>
                    </div>

                    <div class="panel-body">
                        <form method="post" class="form-horizontal">
                            <div class="form-group">
                                <label class="control-label col-md-2">选择下单QQ</label>
                                <div class="col-md-10">
                                    <select class="form-control" name="qid">
                                        {volist name="qqList" id="qq"}
                                        <option value="{$qq.qid}">{$qq.uin}</option>
                                        {/volist}
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2">代挂项目</label>
                                <div class="col-md-10">
                                    <select class="form-control" name="tid" id="dgtid" onchange="getPoint();">
                                        {volist name="toolList" id="tool"}
                                        <option value="{$tool.tid}" price="{$tool.price}">{$tool.name}</option>
                                        {/volist}
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2">下单月数</label>
                                <div class="col-md-10">
                                    <div class="input-group">
                                        <input type="number" name="num" value="1" id="num" class="form-control"
                                               onchange="getPoint();" required>
                                        <div class="input-group-addon">月</div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2">消耗金币</label>
                                <div class="col-md-10">
                                    <div class="input-group">
                                        <input type="text" value="{$price_all}" class="form-control" id="need"
                                               disabled>
                                        <div class="input-group-addon">个</div>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-md-2"></label>
                                <div class="col-md-10">
                                    <button class="btn btn-primary" type="submit">确认下单</button>
                                    <button class="btn btn-default-outline" type="reset">重置</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {/block}
    {block name="footJs"}
    <script type="text/javascript">
        function getPoint() {
            var value = $('#num').val();
            var tid = $('#dgtid option:selected').val();
            var price = {$price_dx};
            if (tid == 1) {
                price = {$price_all};
            }
            $('#need').val(value * price);
        }
    </script>
    {/block}
